<?php


namespace App\Models;


use Illuminate\Database\Eloquent\Model;

/**
 * Class Tally
 * @package App\Models
 * @property Product product
 * @author luffyzhao@vip.126.com
 */
class Tally extends Model
{
    protected $table = 'tally';

    protected $fillable = ['code', 'product_id', 'barcode', 'warehousing_id', 'quantity'];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     * @author luffyzhao@vip.126.com
     */
    public function product(){
        return $this->belongsTo(Product::class);
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     * @author luffyzhao@vip.126.com
     */
    public function warehousing(){
        return $this->belongsTo(Warehousing::class);
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     * @author luffyzhao@vip.126.com
     */
    public function details(){
        return $this->hasMany(TallyDetail::class);
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function logs(){
        return $this->hasMany(TallyLog::class);
    }


}
